#ifndef _T5L_DGUS_H_
#define _T5L_DGUS_H_
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <string.h>

#define T5L_DGUS_Head           0x5AA5
#define T5L_DGUS_Head0          (uint8_t)(T5L_DGUS_Head>>8)
#define T5L_DGUS_Head1          (uint8_t)(T5L_DGUS_Head&0xFF)

#define T5L_DGUS_CMD_Write      0x82
#define T5L_DGUS_CMD_Read       0x83

#define T5L_DGUS_Base_Graph_Value_Add   0x5440
#define T5L_DGUS_Base_Graph_Value_Add0  (uint8_t)(T5L_DGUS_Base_Graph_Value_Add>>8)
#define T5L_DGUS_Base_Graph_Value_Add1  (uint8_t)(T5L_DGUS_Base_Graph_Value_Add&0xFF)

#define T5L_DGUS_Base_Graph_P2P_Data_CMD    0x0002
#define T5L_DGUS_Base_Graph_P2P_Data_CMD0    (uint8_t)(T5L_DGUS_Base_Graph_P2P_Data_CMD>>8)
#define T5L_DGUS_Base_Graph_P2P_Data_CMD1    (uint8_t)(T5L_DGUS_Base_Graph_P2P_Data_CMD&0xFF)

#define T5L_DGUS_Base_Graph_P2P_Data_Color  0xF800

#define T5L_DGUS_Base_Graph_P2P_Data_End    0xFF00
#define T5L_DGUS_Base_Graph_P2P_Data_End0    (uint8_t)(T5L_DGUS_Base_Graph_P2P_Data_End>>8)
#define T5L_DGUS_Base_Graph_P2P_Data_End1    (uint8_t)(T5L_DGUS_Base_Graph_P2P_Data_End&0xFF)

//Size=len(CMD+Value_Add+Data)=len(Data)+3      All_Len=Size+3
#pragma pack(1)
typedef struct
{
    uint8_t Head[2];
    uint8_t Size;
    uint8_t CMD;
    uint8_t Value_Add[2];
    uint8_t Data[249];
}T5L_DGUS_Struct;
#pragma pack()


#pragma pack(1)
typedef struct
{
    uint16_t X;
    uint16_t Y;
}Location_Struct;
#pragma pack()

#pragma pack(1)
typedef struct
{
    uint8_t X[2];
    uint8_t Y[2];
}T5L_DGUS_Base_Graph_Location_Struct;
#pragma pack()

//P2P_Size=len(Location)-1  P2P_Data_Len=8+len(Location)*4=(P2P_Size+1)*4+8
#pragma pack(1)
typedef struct
{
    uint8_t P2P_CMD[2];
    uint8_t P2P_Size[2];
    uint8_t Color[2];
    T5L_DGUS_Base_Graph_Location_Struct Location[15];
    uint8_t End[2];
}T5L_DGUS_Base_Graph_P2P_Data_Struct;
#pragma pack()

#endif

